import p_400.UDPPoke;

import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.net.UnknownHostException;

public class Test {

    public static void main(String[] args) {

//        TestInetAddress address = new TestInetAddress();
//        address.showSome();
//        InterfaceListener listener = new InterfaceListener();
//        listener.doSome();
//        TestProtocol protocol = new TestProtocol();
//        protocol.doSome();
//        SourceViewer viewer = new SourceViewer();
//        viewer.doSome();
//        URISpliter spliter = new URISpliter();
//        spliter.doSome();
//        BinarySaver saver = new BinarySaver();
//        saver.doSome();

//        HeaderViewer viewer = new HeaderViewer();
//        viewer.doSome();

//        testUdp();

    }


    private static void testUdp() {
        try {
            InetAddress host = InetAddress.getByName("百度");
            int port = 8092;
            UDPPoke udpPoke = new UDPPoke(host, port, 8092, 30000);
            byte[] response = udpPoke.poke();
            if (response == null) {
                System.out.println("在规定时间内无响应");
                return;
            }
            try {
                String result = new String(response, "US-ASCII");
                System.out.println("udp 的响应-->" + result);
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }

        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
    }
}
